﻿@using System.Collections.Generic;
@using hc.epm.ViewModel;

@model List<AttendanceBranchCountView>

@{
    ViewBag.Title = "考勤人员统计";
}

<link href="~/Resource/css/ProjectManagement.css" rel="stylesheet" />
<style>
    h2 {
        font-size: 24px;
        font-weight: 600;
        text-align: center;
        margin: 20px 0;
    }

    .list-box > div {
        margin: 10px 0;
    }

    .control-label {
        font-weight: 500;
        margin-top: 5px;
        padding-right: 0;
        padding-left: 0;
        width: 22%;
    }

    .control-label-div {
        width: 78%;
    }

    .timer-pic {
        position: absolute;
        top: 9px;
        left: 100px;
    }

    .timeGroup {
        width: 47%;
        display: inline-block;
        position: relative;
    }

        .timeGroup > i {
            position: absolute;
            top: 9px;
            right: 6px;
        }

    .form-sub {
        display: flex;
        justify-content: space-between;
    }

        .form-sub > button {
            width: 150px;
            height: 35px;
            border: none;
            background-color: #6a6969;
            color: #fff;
        }

    .list-tab {
        margin: 20px 0;
    }
</style>

<div class="contentData">
    @*<h2>2019-12-16 考勤统计</h2>*@
    <div class="form-query">
        <form method="get">

            <div class="module-div">
                <h4>查询条件</h4>
                <div class="row list-box" style="margin:10px -15px">
                    <div class="col-lg-4 col-sm-4">
                        <div class="form-group">
                            <label class="control-label col-lg-3 col-sm-3">项目名称 : </label>
                            <div class="col-lg-8 col-sm-8 control-label-div">
                                <input class="form-control" type="text" name="ProName" value="@ViewBag.ProName" placeholder="请输入项目名称">
                            </div>
                        </div>
                    </div>

                    <div class="col-lg-4 col-sm-4">
                        <div class="form-group">
                            <label class="control-label col-lg-3 col-sm-3">地市公司 : </label>
                            <div class="col-lg-8 col-sm-8 control-label-div">
                                @Html.DropDownList("companyId", ViewBag.companyId as SelectList, null, new { @class = "form-control" })
                            </div>
                        </div>
                    </div>

                    <div class="col-lg-4 col-sm-4">
                        <div class="form-group">
                            <label class="control-label col-lg-3 col-sm-3">打卡时间 : </label>
                            <div class="col-lg-8 col-sm-8 control-label-div">
                                <div class="timeGroup">
                                    <input type="text" class="form-control" id="startTime" name="startTime" value="@ViewBag.startTime" onfocus=this.blur() onClick="WdatePicker({ onpicked: function (dp) { $('#endTime').val(''); }})" placeholder="起始时间">
                                    <i onClick="WdatePicker({ el: 'startTime' })" class="iconfont pic">&#xe7e2;</i>
                                </div>
                                -
                                <div class="timeGroup">
                                    <input type="text" class="form-control" id="endTime" name="endTime" value="@ViewBag.endTime" onfocus=this.blur() onClick="WdatePicker({ onpicked: function (dp) { }, minDate: '#F{$dp.$D(\'startTime\')}', })" placeholder="终止时间">
                                    <i onClick="WdatePicker({ el: 'endTime' })" class="iconfont pic">&#xe7e2;</i>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4 col-sm-4">
                        <div class="form-group">
                            <label class="control-label col-lg-3 col-sm-3">考勤人员 : </label>
                            <div class="col-lg-8 col-sm-8 control-label-div">
                                <input class="form-control" type="text" name="userName" value="@ViewBag.userName" placeholder="请输入人员名称">
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-sub" style="display:flow-root;margin-bottom: 25px;">
                <button type="submit" id="btnsel" style="float:right" class="checkright" data-module="SignManage" data-right="Browse">查 询</button>
            </div>
        </form>
    </div> 
    <div class="list-tab">
        <table class="datalist" style="word-break:break-all;word-wrap:break-word">
            <thead>
                <tr>
                    <th width="50">序号</th>
                    <th width="100">分公司</th>
                    <th width="100">项目名称</th>
                    <th width="100">考勤人员</th>
                    <th width="100">总考勤次数</th>
                    <th width="100">实际打卡总数</th>
                    <th width="100">考勤率</th>
                    @*<th width="100">操作</th>*@
                    <th width="100">打卡时间</th>
                </tr>
            </thead>

            <tbody id="tbody">
                @{
                    int index = (ViewBag.pageIndex - (ViewBag.pageIndex - 1)) * ((ViewBag.pageIndex - 1) * 10);
                }
                @if (Model != null)
                {
                    foreach (var item in Model)
                    {
                        index++;
                        <tr>

                            <td>@index</td>
                            <td>@item.PreName</td>
                            <td>@item.Name</td>
                            <td>@item.userName<d>
                            <td>@item.RegulationsCount</td>
                            <td>@item.ActualCount</td>
                            <td>@item.AttendanceRate</td>
                            @*<td>@item.dateTime</td>*@
                            @if (!string.IsNullOrEmpty(item.dateTime))
                            {
                                <td>@item.dateTime.Substring(0, 11)</td>
                            }
                            else
                            {
                                <td></td>
                            }
                        </tr>
                    }
                }
                else {
                    <tr>
                        <td colspan="12" class="table-center">
                            暂无数据
                        </td>
                    </tr>
                }

            </tbody>
        </table>
    </div>
    <div id="page" style="text-align:right; margin-right:5px;"></div>
</div>
<script>
    layui.use(['layer', 'element', 'laypage'], function () {
        var layer = layui.layer, form = layui.form, element = layui.element, $ = layui.jquery, laypage = layui.laypage;
        //分页
        laypage.render({
            elem: 'page',
            count: '@ViewBag.Total',
            curr: '@ViewBag.pageIndex',
            layout: ['prev', 'page', 'next', 'skip', 'count'],
            theme: '#6a6969',
            jump: function (obj, first) {
                if (!first) {
                    //得到了当前页，用于向服务端请求对应数据
                    var curr = obj.curr;
                    var search = $("form").serialize();
                    window.location.href = "/AttendanceReport/AttendanceIndex?pageIndex=" + curr + "&" + search;
                }
            }
        });
    })
</script>